//
//  YSpreadViewItemView.h
//  yuimall_Iphone
//
//  Created by yuike6 yuike6 on 12-4-18.
//  Copyright (c) 2012年 yuike. All rights reserved.
//

#import "UIViewEx.h"
#import "YSpreadViewModel.h"
#import "YSpreadViewItemViewSubViewItemView.h"


#define _SUBJECT_ITEM_HEIGHT    60
#define _ITEM_HEIGHT_           50

@class YSpreadViewItemViewSubjectView;
@protocol YSpreadViewItemViewSubjectViewDelegate <NSObject>
-(void) clickSubjectView:(YSpreadViewItemViewSubjectView *) subjectView;
- (void) subjectImageClick:(YSpreadViewItemViewSubjectView *) subjectView;

-(BOOL) isNeedShowHighLight:(YSpreadViewItemViewSubjectView *) subjectView;
@end

@protocol YSpreadViewItemViewDelegate <NSObject>
- (void) spread:(id) obj;
- (void) restore:(id) obj;

- (void) clickWhichSubItem: (YSpreadViewItemViewSubjectView *) subjectView subItemView:(YSpreadViewItemViewSubViewItemView *) whichView;
- (BOOL) isNeedShowHighLight:(YSpreadViewItemViewSubjectView *) subjectView;
@end

@interface YSpreadViewItemView : UIViewEx<YSpreadViewItemViewSubjectViewDelegate, YSpreadViewItemViewSubViewItemViewDelegate>
{
    YSpreadViewModel * data_;
    
    YSpreadViewItemViewSubjectView * subjectView_;
    
    id<YSpreadViewItemViewDelegate> delegate_;
    
    UIViewEx * subItemPanl;
    NSMutableArray * itemViews_;
    
    BOOL isSpread;
}

@property (nonatomic, strong) YSpreadViewModel * data;

@property (nonatomic, strong) YSpreadViewItemViewSubjectView * subjectView;

@property (nonatomic, assign) id <YSpreadViewItemViewDelegate> delegate;

@property (nonatomic, strong) UIViewEx * subItemPanl;
@property (nonatomic, strong) NSMutableArray * itemViews;

@end



@interface YSpreadViewItemViewSubjectView : UIViewEx
{
    UIButton * imageView_;    
    UILabel * title_;
    
    UIImageView * flagImageView_;
    
    YSpreadViewItemModel * itemModel_;
    id<YSpreadViewItemViewSubjectViewDelegate> delegate_;
    
    UIImageView * bgImageView_;
    
    BOOL isSpread;
    
    BOOL isHighLight;
}

@property (nonatomic, strong) UIButton * imageView; 
@property (nonatomic, strong) UILabel * title;

@property (nonatomic, strong) UIImageView * flagImageView;
@property (nonatomic, strong) YSpreadViewItemModel * itemModel;

@property (nonatomic, assign) id<YSpreadViewItemViewSubjectViewDelegate> delegate;
@property (nonatomic, strong) UIImageView * bgImageView;

@property (nonatomic, assign)   BOOL isHighLight;
@end

